package com.biz.primus.base.elasticsearch.entities;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

/**
 * 商户索引实体
 *
 * @author david-liu
 * @date 2017年01月05日
 * @reviewer
 * @see
 */
@Document(indexName = "bbc_vendors", type = "vendor", refreshInterval = "3s")
public class VendorEntity implements Serializable {
    private static final long serialVersionUID = -2088205884413621239L;

    /**
     * 商户 ID
     */
    @Id
    @Field(type = FieldType.Long, index = FieldIndex.not_analyzed, store = true)
    private Long vendorId;

    /**
     * 店铺名称
     */
    @Field(type = FieldType.String, store = true, index = FieldIndex.not_analyzed)
    private String vendorName;

    /**
     * 店铺编码
     */
    @Field(type = FieldType.String, index = FieldIndex.not_analyzed, store = true)
    private String vendorCode;

    /**
     * 商家运营类型(商家自运营/平台代运营)
     *
     */
    @Field(type = FieldType.Integer, index = FieldIndex.not_analyzed)
    private Integer vendorOperationType;

    /**
     * 商铺状态(开业/关店/冻结)
     *
     */
    @Field(type = FieldType.Integer, index = FieldIndex.not_analyzed)
    private Integer vendorStatus;

    /**
     * 商户类型(A类商家/B类商家)
     *
     */
    @Field(type = FieldType.Integer, index = FieldIndex.not_analyzed)
    private Integer vendorType;

    /**
     * 店铺所有人
     */
    @Field(type = FieldType.String, store = true)
    private String owner;

    /**
     * 店铺所有人真实姓名
     */
    @Field(type = FieldType.String, store = true)
    private String ownerRealName;

    /**
     * 店铺所有人电话
     */
    @Field(type = FieldType.String, index = FieldIndex.not_analyzed)
    private String ownerMobile;

    /**
     * 开户银行
     */
    @Field(type = FieldType.String, index = FieldIndex.not_analyzed)
    private String openingBank;

    /**
     * 店铺审核状态
     *
     */
    @Field(type = FieldType.Integer, index = FieldIndex.not_analyzed)
    private Integer auditStatus;

    /**
     * 商家经营范围品牌(存放品牌名, 以逗号隔开)
     */
    @Field(type = FieldType.String, store = true, analyzer = "ik", searchAnalyzer = "ik_smart")
    private String brands;

    /**
     * 聚合分词搜索字段(用于将需要分词搜索的字段聚合在一起, 提升分词搜索的效率)
     */
    @Field(type = FieldType.String, store = true, analyzer = "ik", searchAnalyzer = "ik_smart")
    private String content;

    /**
     * 索引最后更新时间
     */
    @Field(type = FieldType.Long, index = FieldIndex.not_analyzed, store = true)
    private Long lastUpdateTime;

    /**
     * 存在库存的省的id，以"_"分割
     */
    @Field(type = FieldType.String,  analyzer = "ik", searchAnalyzer = "ik_smart", store = true)
    private String existPInventoryProvinceIds;

    public String getExistPInventoryProvinceIds() {
        return existPInventoryProvinceIds;
    }

    public void setExistPInventoryProvinceIds(String existPInventoryProvinceIds) {
        this.existPInventoryProvinceIds = existPInventoryProvinceIds;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Long getVendorId() {
        return vendorId;
    }

    public void setVendorId(Long vendorId) {
        this.vendorId = vendorId;
    }

    public String getVendorName() {
        return vendorName;
    }

    public void setVendorName(String vendorName) {
        this.vendorName = vendorName;
    }

    public String getVendorCode() {
        return vendorCode;
    }

    public void setVendorCode(String vendorCode) {
        this.vendorCode = vendorCode;
    }

    public Integer getVendorOperationType() {
        return vendorOperationType;
    }

    public void setVendorOperationType(Integer vendorOperationType) {
        this.vendorOperationType = vendorOperationType;
    }

    public Integer getVendorStatus() {
        return vendorStatus;
    }

    public void setVendorStatus(Integer vendorStatus) {
        this.vendorStatus = vendorStatus;
    }

    public Integer getVendorType() {
        return vendorType;
    }

    public void setVendorType(Integer vendorType) {
        this.vendorType = vendorType;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getOwnerRealName() {
        return ownerRealName;
    }

    public void setOwnerRealName(String ownerRealName) {
        this.ownerRealName = ownerRealName;
    }

    public String getOwnerMobile() {
        return ownerMobile;
    }

    public void setOwnerMobile(String ownerMobile) {
        this.ownerMobile = ownerMobile;
    }

    public String getOpeningBank() {
        return openingBank;
    }

    public void setOpeningBank(String openingBank) {
        this.openingBank = openingBank;
    }

    public Integer getAuditStatus() {
        return auditStatus;
    }

    public void setAuditStatus(Integer auditStatus) {
        this.auditStatus = auditStatus;
    }

    public String getBrands() {
        return brands;
    }

    public void setBrands(String brands) {
        this.brands = brands;
    }

    public Long getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(Long lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
